package com.openxt.nbzj.fragment;

import android.app.Activity;

import java.util.LinkedList;

/**
 * Created by tongky on 2016/6/17.
 */
public class OpenxtBaseManager {
    private LinkedList<Activity> activityList = new LinkedList<Activity>();
    private static OpenxtBaseManager instance;

    public static OpenxtBaseManager getInstance() {
        if (instance == null)
            instance = new OpenxtBaseManager();
        return instance;
    }

    public void addActivity(Activity activity) {
        activityList.add(activity);
    }

    public void removeActivity(Activity activity) {
        if(activityList.contains(activity))
            activityList.remove(activity);
    }

    public void exit() {
        for (Activity activity : activityList) {
            activity.finish();
        }
    }
}